﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using LprMiddleWare.HangWang;

namespace LprMiddleWare.Model
{
    public class LicensePlate : INotifyPropertyChanged
    {
        public List<byte[]> JpegBuffers { get; set; }
        public CaptureReason CaptureReason { get; set; }
        public int Speed { get; set; }
        public int PlateType { get; set; }

        private string _licenseNumber;
        public string LicenseNumber
        {
            get { return _licenseNumber; }
            set
            {
                _licenseNumber = value;
                RaisePropertyChanged("LicenseNumber");
            }
        }


        private string _deviceId;
        public string DeviceId
        {
            get { return _deviceId; }
            set
            {
                _deviceId = value;
                RaisePropertyChanged("DeviceId");
            }
        }

        private int _lanNo;
        public int LanNo
        {
            get { return _lanNo; }
            set
            {
                _lanNo = value;
                RaisePropertyChanged("LaneNo");
            }
        }

        /// <summary>
        /// The <see cref="CaptureTime" /> property's name.
        /// </summary>
        public const string CaptureTimePropertyName = "CaptureTime";

        private DateTime _captureTime;

        public DateTime CaptureTime
        {
            get
            {
                return _captureTime;
            }

            set
            {
                if (_captureTime == value)
                {
                    return;
                }

                _captureTime = value;
                // Update bindings, no broadcast
                RaisePropertyChanged(CaptureTimePropertyName);

            }
        }


        public event PropertyChangedEventHandler PropertyChanged;

        public void RaisePropertyChanged(string propetyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propetyName));
        }
    }
}
